 /*
  * Mango CMS
  * Copyright 2008, Mango Web, and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
package org.mangocms.plugin.article.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.validator.NotNull;
import org.mangocms.model.ContentEntity;

/**
 * A comment for a Mango article
 * 
 * @author <a href="tanordheim@gmail.com">Trond Arve Nordheim</a>
 * @version $Revision: 1.1 $
 */
@Entity
@Table(name = "mango_article_comments")
public class ArticleComment extends ContentEntity {

	private static final long serialVersionUID = 1L;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "article_id", referencedColumnName = "id")
	@NotNull
	private Article article;
	
	@Column(name = "body")
	@Lob
	private String body;
	
	/**
	 * Create a new ArticleComment.
	 */
	public ArticleComment() {
		super();
	}

	/**
	 * Create a new ArticleComment for the specified article.
	 * 
	 * @param article
	 */
	public ArticleComment(Article article) {
		super();
		this.article = article;
	}

	@Override
	public String getEntityName() {
		return "org.mangocms.articleComment";
	}

	/**
	 * Get the article.
	 * 
	 * @return the article.
	 */
	public Article getArticle() {
		return article;
	}

	/**
	 * Set the article.
	 * 
	 * @param article The article to set.
	 */
	public void setArticle(Article article) {
		this.article = article;
	}

	/**
	 * Get the body.
	 * 
	 * @return the body.
	 */
	public String getBody() {
		return body;
	}

	/**
	 * Set the body.
	 * 
	 * @param body The body to set.
	 */
	public void setBody(String body) {
		this.body = body;
	}

}
